<?php
declare (strict_types = 1);

namespace app\index\controller;

use app\index\BaseController;
use app\index\model\Article;
use app\index\model\Block;

class Search extends BaseController
{
    //搜索文章
    public function searchArticle(string $title){

        return view('search-article',[

            //文章列表
            'count' => Article::getCount([['title', 'like', '%'.$title.'%']]),
            'limit' => Article::LIMIT_NUM,


            //面包屑
            'crumb' => [
                'home'          => '/',
                '搜索文章'       => request()->url(),
            ],



            //*热门文章
            'activeArticles' => Block::getActiveArticles(),
            //热门标签
            'activeTags' => Block::getActiveTags(),
            //*推荐作者
            'activeAuthors' => Block::getActiveAuthors(),
            //*推荐话题
            'activeTopics' => Block::getActiveTopics(),
        ]);
    }
}
